package com.qf.cx.simplenms.link.model;

import java.util.Arrays;
import java.util.List;

import org.apache.log4j.Logger;

public class ReadCustomResultSpec extends AbstractOpResultSpec{

	/** logger. */
	private static final Logger LOG = Logger.getLogger(ReadCustomResultSpec.class);
	
	private byte[] cid = new byte[5];
	private byte[] fpdh = new byte[2];
	private byte syxz;
	private byte[] ccrq = new byte[2];
	private byte[] cllx = new byte[2];
	private byte[] gl = new byte[2];
	private byte[] pl = new byte[2];
	private byte hpzl;
	private byte[] hphmxh = new byte[6];
	private byte[] jyyxq = new byte[2];
	private byte qzbfq;
	private byte[] zkzl = new byte[2];
	private byte csys;	
	private byte hphmxhLen;	
	
	private byte cidUsed;		
	private byte fpdhUsed;		
	private byte syxzUsed;	
	
	private byte ccrqUsed;		
	private byte cllxUsed;	
	private byte glUsed;		
	
    private byte plUsed;
    private byte hpzlUsed;
    private byte hphmxhUsed;
    
    private byte jyyxqUsed;
    private byte qzbfqUsed;
    private byte zkzlUsed;
    private byte csysUsed;
  
    
	public ReadCustomResultSpec() {
		super();
		// TODO Auto-generated constructor stub
	}  	

	public byte[] getCid() {
		return cid;
	}

	public void setCid(byte[] cid) {
		if(this.cid.length != cid.length)
		{
			LOG.error("cid len error");
		}
		System.arraycopy(cid, 0, this.cid, 0, this.cid.length);
	}
	
	public void setCid(List<Integer> cid) {
		if(this.cid.length != cid.size())
		{
			LOG.error("cid len error");
		}
		for(int i = 0; i < cid.size(); i++){
			this.cid[i] = cid.get(i).byteValue();
		}
	}
	
	public byte[] getFpdh() {
		return fpdh;
	}

	public void setFpdh(byte[] fpdh) {
		
		if(this.fpdh.length != fpdh.length)
		{
			LOG.error("fpdh len error");
		}
		System.arraycopy(fpdh, 0, this.fpdh, 0, this.fpdh.length);
	}

	public void setFpdh(List<Integer> fpdh) {
		
		if(this.fpdh.length != fpdh.size())
		{
			LOG.error("fpdh len error");
		}
		for(int i = 0; i < fpdh.size(); i++){
			this.fpdh[i] = fpdh.get(i).byteValue();
		}
	}	
	
	public byte getSyxz() {
		return syxz;
	}

	public void setSyxz(byte syxz) {
		this.syxz = syxz;
	}

	public byte[] getCcrq() {
		return ccrq;
	}

	public void setCcrq(byte[] ccrq) {
		
		if(this.ccrq.length != ccrq.length)
		{
			LOG.error("ccrq len error");
		}
		System.arraycopy(ccrq, 0, this.ccrq, 0, this.ccrq.length);
		
	}
	public void setCcrq(List<Integer> ccrq) {
		
		if(this.ccrq.length != ccrq.size())
		{
			LOG.error("ccrq len error");
		}
		for(int i = 0; i < ccrq.size(); i++){
			this.ccrq[i] = ccrq.get(i).byteValue();
		}
	}
	public byte[] getCllx() {
		return cllx;
	}

	public void setCllx(byte[] cllx) {
		
		if(this.cllx.length != cllx.length)
		{
			LOG.error("cllx len error");
		}
		System.arraycopy(cllx, 0, this.cllx, 0, this.cllx.length);
	}
	public void setCllx(List<Integer> cllx) {
		
		if(this.cllx.length != cllx.size())
		{
			LOG.error("cllx len error");
		}
		for(int i = 0; i < cllx.size(); i++){
			this.cllx[i] = cllx.get(i).byteValue();
		}
	}
	public byte[] getGl() {
		return gl;
	}

	public void setGl(byte[] gl) {
		if(this.gl.length != gl.length)
		{
			LOG.error("gl len error");
		}
		System.arraycopy(gl, 0, this.gl, 0, this.gl.length);
	}
	public void setGl(List<Integer> gl) {
		if(this.gl.length != gl.size())
		{
			LOG.error("gl len error");
		}
		for(int i = 0; i < gl.size(); i++){
			this.gl[i] = gl.get(i).byteValue();
		}
	}
	public byte[] getPl() {
		return pl;
	}

	public void setPl(byte[] pl) {

		if(this.pl.length != pl.length)
		{
			LOG.error("pl len error");
		}
		System.arraycopy(pl, 0, this.pl, 0, this.pl.length);
		
	}
	public void setPl(List<Integer>  pl) {

		if(this.pl.length != pl.size())
		{
			LOG.error("pl len error");
		}
		for(int i = 0; i < pl.size(); i++){
			this.pl[i] = pl.get(i).byteValue();
		}
		
	}
	public byte getHpzl() {
		return hpzl;
	}

	public void setHpzl(byte hpzl) {
		this.hpzl = hpzl;
	}

	public byte[] getHphmxh() {
		return hphmxh;
	}

	public void setHphmxh(byte[] hphmxh) {
		
		if(this.hphmxh.length != hphmxh.length)
		{
			LOG.error("hphmxh len error");
		}
		System.arraycopy(hphmxh, 0,this.hphmxh, 0, this.hphmxh.length);
	}
	public void setHphmxh(List<Integer> hphmxh) {
		
		if(this.hphmxh.length != hphmxh.size())
		{
			LOG.error("hphmxh len error");
		}
		for(int i = 0; i < hphmxh.size(); i++){
			this.hphmxh[i] = hphmxh.get(i).byteValue();
		}
	}
	public byte[] getJyyxq() {
		return jyyxq;
	}

	public void setJyyxq(byte[] jyyxq) {
		
		if(this.jyyxq.length != jyyxq.length)
		{
			LOG.error("jyyxq len error");
		}
		System.arraycopy(jyyxq, 0,this.jyyxq, 0, this.jyyxq.length);
		
	}
	public void setJyyxq(List<Integer> jyyxq) {
		
		if(this.jyyxq.length != jyyxq.size())
		{
			LOG.error("jyyxq len error");
		}
		for(int i = 0; i < jyyxq.size(); i++){
			this.jyyxq[i] = jyyxq.get(i).byteValue();
		}
		
	}
	public byte getQzbfq() {
		return qzbfq;
	}

	public void setQzbfq(byte qzbfq) {
		this.qzbfq = qzbfq;
	}

	public byte[] getZkzl() {
		return zkzl;
	}

	public void setZkzl(byte[] zkzl) {
		if(this.zkzl.length != zkzl.length)
		{
			LOG.error("zkzl len error");
		}
		System.arraycopy(zkzl, 0,this.zkzl, 0, this.zkzl.length);
	}
	public void setZkzl(List<Integer> zkzl) {
		if(this.zkzl.length != zkzl.size())
		{
			LOG.error("zkzl len error");
		}
		for(int i = 0; i < zkzl.size(); i++){
			this.zkzl[i] = zkzl.get(i).byteValue();
		}
	}
	public byte getCsys() {
		return csys;
	}

	public void setCsys(byte csys) {
		this.csys = csys;
	}

	public byte getHphmxhLen() {
		return hphmxhLen;
	}

	public void setHphmxhLen(byte hphmxhLen) {
		this.hphmxhLen = hphmxhLen;
	}

	public byte getCidUsed() {
		return cidUsed;
	}

	public void setCidUsed(byte cidUsed) {
		this.cidUsed = cidUsed;
	}

	public byte getFpdhUsed() {
		return fpdhUsed;
	}

	public void setFpdhUsed(byte fpdhUsed) {
		this.fpdhUsed = fpdhUsed;
	}

	public byte getSyxzUsed() {
		return syxzUsed;
	}

	public void setSyxzUsed(byte syxzUsed) {
		this.syxzUsed = syxzUsed;
	}

	public byte getCcrqUsed() {
		return ccrqUsed;
	}

	public void setCcrqUsed(byte ccrqUsed) {
		this.ccrqUsed = ccrqUsed;
	}

	public byte getCllxUsed() {
		return cllxUsed;
	}

	public void setCllxUsed(byte cllxUsed) {
		this.cllxUsed = cllxUsed;
	}

	public byte getGlUsed() {
		return glUsed;
	}

	public void setGlUsed(byte glUsed) {
		this.glUsed = glUsed;
	}

	public byte getPlUsed() {
		return plUsed;
	}

	public void setPlUsed(byte plUsed) {
		this.plUsed = plUsed;
	}

	public byte getHpzlUsed() {
		return hpzlUsed;
	}

	public void setHpzlUsed(byte hpzlUsed) {
		this.hpzlUsed = hpzlUsed;
	}

	public byte getHphmxhUsed() {
		return hphmxhUsed;
	}

	public void setHphmxhUsed(byte hphmxhUsed) {
		this.hphmxhUsed = hphmxhUsed;
	}

	public byte getJyyxqUsed() {
		return jyyxqUsed;
	}

	public void setJyyxqUsed(byte jyyxqUsed) {
		this.jyyxqUsed = jyyxqUsed;
	}

	public byte getQzbfqUsed() {
		return qzbfqUsed;
	}

	public void setQzbfqUsed(byte qzbfqUsed) {
		this.qzbfqUsed = qzbfqUsed;
	}

	public byte getZkzlUsed() {
		return zkzlUsed;
	}

	public void setZkzlUsed(byte zkzlUsed) {
		this.zkzlUsed = zkzlUsed;
	}

	public byte getCsysUsed() {
		return csysUsed;
	}

	public void setCsysUsed(byte csysUsed) {
		this.csysUsed = csysUsed;
	}
	
	private int[] byte2uchar(byte[] s)
	{
		int[] d = new int[s.length];
		int tmp = 0;
		for(int i = 0; i < s.length; i++)
		{
			tmp  = s[i];
			tmp = tmp & 0xff;
			d[i] = tmp;
		}		
		return d;
	}


	@Override
	public String toString() {
		return "ReadCustomResultSpec [opId=" + opId + ", result=" + result + ", cid=" + Arrays.toString(byte2uchar(cid)) + ", fpdh="
				+ Arrays.toString(byte2uchar(fpdh)) + ", syxz=" + syxz + ", ccrq=" + Arrays.toString(byte2uchar(ccrq)) + ", cllx="
				+ Arrays.toString(byte2uchar(cllx)) + ", gl=" + Arrays.toString(byte2uchar(gl)) + ", pl=" + Arrays.toString(byte2uchar(pl)) + ", hpzl="
				+ hpzl + ", hphmxh=" + Arrays.toString(byte2uchar(hphmxh)) + ", jyyxq=" + Arrays.toString(byte2uchar(jyyxq)) + ", qzbfq="
				+ qzbfq + ", zkzl=" + Arrays.toString(byte2uchar(zkzl)) + ", csys=" + csys + ", hphmxhLen=" + hphmxhLen
				+ ", cidUsed=" + cidUsed + ", fpdhUsed=" + fpdhUsed + ", syxzUsed=" + syxzUsed + ", ccrqUsed="
				+ ccrqUsed + ", cllxUsed=" + cllxUsed + ", glUsed=" + glUsed + ", plUsed=" + plUsed + ", hpzlUsed="
				+ hpzlUsed + ", hphmxhUsed=" + hphmxhUsed + ", jyyxqUsed=" + jyyxqUsed + ", qzbfqUsed=" + qzbfqUsed
				+ ", zkzlUsed=" + zkzlUsed + ", csysUsed=" + csysUsed + "]";
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Arrays.hashCode(ccrq);
		result = prime * result + ccrqUsed;
		result = prime * result + Arrays.hashCode(cid);
		result = prime * result + cidUsed;
		result = prime * result + Arrays.hashCode(cllx);
		result = prime * result + cllxUsed;
		result = prime * result + csys;
		result = prime * result + csysUsed;
		result = prime * result + Arrays.hashCode(fpdh);
		result = prime * result + fpdhUsed;
		result = prime * result + Arrays.hashCode(gl);
		result = prime * result + glUsed;
		result = prime * result + Arrays.hashCode(hphmxh);
		result = prime * result + hphmxhLen;
		result = prime * result + hphmxhUsed;
		result = prime * result + hpzl;
		result = prime * result + hpzlUsed;
		result = prime * result + Arrays.hashCode(jyyxq);
		result = prime * result + jyyxqUsed;
		result = prime * result + opId;
		result = prime * result + Arrays.hashCode(pl);
		result = prime * result + plUsed;
		result = prime * result + qzbfq;
		result = prime * result + qzbfqUsed;
		result = prime * result + this.result;
		result = prime * result + syxz;
		result = prime * result + syxzUsed;
		result = prime * result + Arrays.hashCode(zkzl);
		result = prime * result + zkzlUsed;
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		ReadCustomResultSpec other = (ReadCustomResultSpec) obj;
		if (!Arrays.equals(ccrq, other.ccrq)) {
			return false;
		}
		if (ccrqUsed != other.ccrqUsed) {
			return false;
		}
		if (!Arrays.equals(cid, other.cid)) {
			return false;
		}
		if (cidUsed != other.cidUsed) {
			return false;
		}
		if (!Arrays.equals(cllx, other.cllx)) {
			return false;
		}
		if (cllxUsed != other.cllxUsed) {
			return false;
		}
		if (csys != other.csys) {
			return false;
		}
		if (csysUsed != other.csysUsed) {
			return false;
		}
		if (!Arrays.equals(fpdh, other.fpdh)) {
			return false;
		}
		if (fpdhUsed != other.fpdhUsed) {
			return false;
		}
		if (!Arrays.equals(gl, other.gl)) {
			return false;
		}
		if (glUsed != other.glUsed) {
			return false;
		}
		if (!Arrays.equals(hphmxh, other.hphmxh)) {
			return false;
		}
		if (hphmxhLen != other.hphmxhLen) {
			return false;
		}
		if (hphmxhUsed != other.hphmxhUsed) {
			return false;
		}
		if (hpzl != other.hpzl) {
			return false;
		}
		if (hpzlUsed != other.hpzlUsed) {
			return false;
		}
		if (!Arrays.equals(jyyxq, other.jyyxq)) {
			return false;
		}
		if (jyyxqUsed != other.jyyxqUsed) {
			return false;
		}
		if (opId != other.opId) {
			return false;
		}
		if (!Arrays.equals(pl, other.pl)) {
			return false;
		}
		if (plUsed != other.plUsed) {
			return false;
		}
		if (qzbfq != other.qzbfq) {
			return false;
		}
		if (qzbfqUsed != other.qzbfqUsed) {
			return false;
		}
		if (result != other.result) {
			return false;
		}
		if (syxz != other.syxz) {
			return false;
		}
		if (syxzUsed != other.syxzUsed) {
			return false;
		}
		if (!Arrays.equals(zkzl, other.zkzl)) {
			return false;
		}
		if (zkzlUsed != other.zkzlUsed) {
			return false;
		}
		return true;
	}


}
